<?php
namespace app\admin\controller\general;
use app\admin\controller\Controller;
use app\admin\model\BaseSetting;

/** 后台关于公司和站点的设置
 * Class Basic
 * @package app\admin\controller\general
 */
class Basic extends Controller
{
    /**
     * 站点设置
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function index()
    {

        $model = BaseSetting::detail('site');

        if (!$this->request->isAjax()) {
            return $this->fetch('index', compact('model'));
        }

       if ($model->edit('site',$this->postData('basic'))) {
        return $this->renderSuccess('更新成功');
        }
        return $this->renderError($model->getError() ?: '更新失败');
    }

    /**
     * 腾讯地图坐标选取器
     * @return mixed
     */
    public function getpoint()
    {
        $this->view->engine->layout(false);
        return $this->fetch('getpoint');
    }
}